package outils;

import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.nio.channels.FileChannel;

/**
 *
 * @author Aude Legrand, Alexandre Becquet
 */
public class OutilsFichier {
    public static void copieFichier(String source,String destination){
        FileChannel in = null;
        FileChannel out = null;
        File fichierSource=new File(source);

        try {
          in = new FileInputStream(fichierSource).getChannel();
          out = new FileOutputStream(destination).getChannel();
          in.transferTo(0, in.size(), out);
        } catch (Exception e) {
          e.printStackTrace();
        } finally {
          if(in != null) {
            try {
              in.close();
            } catch (IOException e) {}
          }
          if(out != null) {
            try {
              out.close();
            } catch (IOException e) {}
          }
        }
    }
}
